#!/usr/bin/env python

"""
remove bed's redundant reads, leave only one copy
use dict
"""

try:
    import psyco
    psyco.full()
except:
    pass

def rm_rdt(file):
    f = open(file, 'r')
    f2 = open(file+'rmrdt.bed', 'w')
    dict = {}
    i=0
    for line in f:
        dict[line.strip()] = i
        i += 1
    f.close()
    for key in dict.keys():
        print >>f2,key
    f2.close()
    
if __name__ == '__main__':
    import sys, time
    if len(sys.argv) == 1:
        print "Usage: python bed_rm_rdt.py bedfile"
    else:
        st = time.time()
        rm_rdt(sys.argv[1])
        et = time.time()
        print 'Done in %2.2f seconds' % (et - st)